#include "widget.h"
#include "ui_widget.h"
#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //初始化第一个输入框
    ui->lineEdit_name->setPlaceholderText("请输入名字");
    ui->lineEdit_name->setClearButtonEnabled(true);
    ui->lineEdit_name->setFrame(true);
    //初始化第二个输入框
    ui->lineEdit_password->setPlaceholderText("请输入一段密码");
    ui->lineEdit_password->setClearButtonEnabled(true);
    ui->lineEdit_password->setEchoMode(QLineEdit::Password);
    ui->lineEdit_password->setFrame(true);
    //初始化第三个输入框
    ui->lineEdit_phone->setPlaceholderText("请输入电话号码");
    ui->lineEdit_phone->setClearButtonEnabled(true);
    //验证密码的格式是否正确，必须是11位数字，并且要按照344的格式来输入
    ui->lineEdit_phone->setInputMask("000 0000 0000");
    ui->lineEdit_phone->setFrame(true);
    ui->lineEdit_phone->setCursorPosition(0);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    ui->pushButton->setText("登记成功，开始进入！");
    QString gender=ui->radioButton_male->isChecked()?"男":"女";
    qDebug()<<"name: "<<ui->lineEdit_name->text()
           <<"password: "<<ui->lineEdit_password->text()
          <<"性别："<<gender
         <<"phone: "<<ui->lineEdit_phone->text();
}
